package org.lw.server.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * todo
 *
 * @author looveh
 * @since 2022/1/22 14:17
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RespBean {

    private long code;
    private String message;
    private Object obj;

    /**
     * 成功返回结果
     *
     * @param message
     * @return {@link RespBean}
     * @author looveh
     * @date 2022/1/22 14:18
    **/
    public static RespBean success(String message) {
        return new RespBean(200, message, null);
    }

    /**
     * 成功返回结果
     *
     * @param message
     * @param obj
     * @return {@link RespBean}
     * @author looveh
     * @date 2022/1/22 14:19
    **/
    public static RespBean success(String message, Object obj) {
        return new RespBean(200, message, obj);
    }

    /**
     * 失败返回结果
     *
     * @param message
     * @return {@link RespBean}
     * @author looveh
     * @date 2022/1/22 14:20
    **/
    public static RespBean error(String message) {
        return new RespBean(500, message, null);
    }

    /**
     * 失败返回结果
     *
     * @param message
     * @param obj
     * @return {@link RespBean}
     * @author looveh
     * @date 2022/1/22 14:21
    **/
    public static RespBean error(String message, Object obj) {
        return new RespBean(500, message, obj);
    }

}
